package com.ruoyi.coal.modules.coalpile.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.coal.modules.coalpile.domain.CoalPileInfoEntity;
import com.ruoyi.coal.modules.coalpile.domain.vo.PdfVo;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CoalPileInfoDao extends BaseMapper<CoalPileInfoEntity> {
    @Select({"select cy.name mei_name, cp.* from cp_coal_pile_info cp,cp_coal_yard_history ch,cp_coal_yard_info cy where cp.history_id=ch.id and ch.coal_yard_id=cy.id and cp.id=#{id};"})
    @Results({@Result(column = "mei_name", property = "meiName"), @Result(column = "name", property = "coalPileInfoEntity.name"), @Result(column = "length", property = "coalPileInfoEntity.length"), @Result(column = "width", property = "coalPileInfoEntity.width"), @Result(column = "height", property = "coalPileInfoEntity.height"), @Result(column = "volume", property = "coalPileInfoEntity.volume"), @Result(column = "area", property = "coalPileInfoEntity.area"), @Result(column = "history_id", property = "coalPileInfoEntity.historyId"), @Result(column = "create_time", property = "coalPileInfoEntity.createTime"), @Result(column = "url_image1", property = "coalPileInfoEntity.urlImage1"), @Result(column = "url_image2", property = "coalPileInfoEntity.urlImage2"), @Result(column = "density", property = "coalPileInfoEntity.density"), @Result(column = "min_point", property = "coalPileInfoEntity.minPoint"), @Result(column = "weight", property = "coalPileInfoEntity.weight"), @Result(column = "max_point", property = "coalPileInfoEntity.maxPoint"), @Result(column = "url_gltf", property = "coalPileInfoEntity.urlGltf"), @Result(column = "cut_id", property = "coalPileInfoEntity.cutId")})
    PdfVo getPdfVoByPileId(@Param("id") Integer paramInteger);

    @Select({"SELECT * FROM cp_coal_pile_info WHERE `name`=#{name} order by create_time desc LIMIT 1"})
    CoalPileInfoEntity coalpile(@Param("name") String paramString);

    List<CoalPileInfoEntity> coalpiles(Map<String, Object> paramMap);
}

